using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using CMS.Core.DataInterfaces;
using CMS.Core.Domain;
using CMS.Data;
using AjaxPro;
using CMS.Presenters.Views.Lookups;

namespace CMS.Presenters.Presenters
{
    public class LookupPresenter
    {
        IDonThuDao iDonThuDao;
        ILookupView iLookupView;

        public LookupPresenter()
        { 
        
        }

        public LookupPresenter(ILookupView iLookupView)
        {
            this.iLookupView = iLookupView;
            this.iLookupView.LinhVucs = new LinhVucDao().GetFieldEqualCriteria("TrangThai", true);
            this.iLookupView.LoaiDons = new LoaiDonDao().GetFieldEqualCriteria("TrangThai", true);
        }

        [AjaxMethod]
        public IList SearchDonThus(string type, String txt1, String txt2, String txt3, String txt4,
            String txtNgay1, String txtNgay2,
            int minSoThuLy, int maxSoThuLy, int maLinhVuc, int maLoaiDon, String maDiaBan,
            int min, int max
            )
        {
            this.iDonThuDao = new DonThuDao();
            return this.iDonThuDao.SearchDonThus(type, txt1, txt2, txt3, txt4, txtNgay1, txtNgay2, 
                minSoThuLy, maxSoThuLy, maLinhVuc, maLoaiDon, maDiaBan, min, max);
        }

        [AjaxMethod]
        public int TotalSearchDonThus(string type, String txt1, String txt2, String txt3, String txt4,
            String txtNgay1, String txtNgay2,
            int minSoThuLy, int maxSoThuLy,
            int maLinhVuc, int maLoaiDon, String maDiaBan
            )
        {
            this.iDonThuDao = new DonThuDao();
            return this.iDonThuDao.TotalSearchDonThus(type, txt1, txt2, txt3, txt4, txtNgay1, txtNgay2, 
                minSoThuLy, maxSoThuLy, maLinhVuc, maLoaiDon, maDiaBan);
        }       
    }
}
